package com.tao.action;

import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.interceptor.annotations.Allowed;
import com.tao.domain.Admin;
import com.tao.service.manager.AdminService;

public class LoginAction extends ActionSupport {

	Admin admin;
	@Allowed
	AdminService adminService;
	
	public String getError_msg() {
		return error_msg;
	}

	public void setError_msg(String error_msg) {
		this.error_msg = error_msg;
	}

	String error_msg;

	private static final long serialVersionUID = 1L;

	@Override
	public String execute() throws Exception {
		
		return "weixiLogin";
	}

	public String Login() {
		List<Admin> list = adminService.
				list("from Admin where username = '"+admin.getUsername()+"' and password = '"+admin.getPassword()+"'", null);
		if (list.size()>0) {
			return SUCCESS;
		} else{
			error_msg = "�ʺŻ��������";
			return ERROR;
		}
	}
	public String Main() {
		return INPUT;
	}
	public Admin getAdmin() {
		return admin;
	}

	public void setAdmin(Admin admin) {
		this.admin = admin;
	}

	public AdminService getAdminService() {
		return adminService;
	}

	public void setAdminService(AdminService adminService) {
		this.adminService = adminService;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}


}
